Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't rescue when require 'rspec/openapi/*' raises LoadError #212

Merged
merged 1 commit into from
Apr 17, 2024

Conversation

tricknotes
Copy link
Contributor

It is useful for debug.
If require 'rspec/openapi/*' raises LoadError, previous code hides original cause.

Copy link

codecov bot commented Apr 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.22%. Comparing base (7d16147) to head (94ae4de).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #212   +/-   ##
=======================================
  Coverage   97.22%   97.22%           
=======================================
  Files          20       20           
  Lines         612      612           
  Branches      133      133           
=======================================
  Hits          595      595           
  Misses         17       17           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@tricknotes tricknotes changed the title Don't rescue when require 'rspec/openapi/*' raises error Don't rescue when require 'rspec/openapi/*' raises LoadError Apr 16, 2024
Copy link
Owner

@exoego exoego left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why an extractor is needed when its corresponding framework is not loaded?

  • rspec/openapi/extractors/hanami.rb requires hanami
  • rspec/openapi/extractors/rails.rb requires rails

So it raises LoadError after rescue

@tricknotes
Copy link
Contributor Author

An extractor is loaded after framework is loaded because it is only required in else case.

Example code is here:

begin
  raise
rescue => e
  puts 'raise'
else
  puts 'else'
end
#=> raise

Copy link
Owner

@exoego exoego left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I see.
I took else for ensure.
else section is executed only when no error raised.

@exoego exoego added the chore label Apr 17, 2024
@exoego exoego merged commit 3394219 into exoego:master Apr 17, 2024
13 checks passed
@exoego exoego added this to the v0.18.0 milestone Apr 17, 2024
@tricknotes tricknotes deleted the improve-feature-detection branch April 17, 2024 03:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants